/**********************************************************************
 * LeechCraft - modular cross-platform feature rich internet client.
 * Copyright (C) 2012  Georg Rudoy
 *
 * Distributed under the Boost Software License, Version 1.0.
 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
 **********************************************************************/

#pragma once

#include <QObject>
#include "sailmipim/multiplayer/imultiplayerproxy.h"
#include "sailmipim/multiplayer/imultiplayerutilproxy.h"
#include "sailmipim/multiplayer/imultiplayerguiproxy.h"

namespace SailmiPIM::Plugin::MultiPlayer
{
	class PlayerTab;

    class MultiPlayerUtilProxy : public QObject
                       , public IMultiPlayerUtilProxy
	{
		Q_OBJECT
        Q_INTERFACES (SailmiPIM::Plugin::MultiPlayer::IMultiPlayerUtilProxy)
	public:
		QString FindAlbumArt (const QString&, bool) const override;
		QList<QFileInfo> RecIterateInfo (const QString&, bool, std::atomic<bool>*) const override;
	};

    class SMPGuiProxy : public QObject
                      , public IMultiPlayerGuiProxy
	{
		Q_OBJECT
        Q_INTERFACES (SailmiPIM::Plugin::MultiPlayer::IMultiPlayerGuiProxy)

		PlayerTab *PlayerTab_ = nullptr;
	public:
		void SetPlayerTab (PlayerTab*);

		void AddCurrentSongTab (const QString&, QWidget*) const override;
		void AddToolbarAction (QAction*) const override;
	};

    class MultiPlayerProxy : public QObject
                   , public IMultiPlayerProxy
	{
		Q_OBJECT
        Q_INTERFACES (SailmiPIM::Plugin::MultiPlayer::IMultiPlayerProxy)

		ILocalCollection * const LocalCollection_;
		ITagResolver * const TagResolver_;

        MultiPlayerUtilProxy UtilProxy_;
        SMPGuiProxy GuiProxy_;
	public:
        MultiPlayerProxy (ILocalCollection*, ITagResolver*);

		ILocalCollection* GetLocalCollection () const override;
		ITagResolver* GetTagResolver () const override;
        const IMultiPlayerUtilProxy* GetUtilProxy () const override;
        const IMultiPlayerGuiProxy* GetGuiProxy () const override;

        SMPGuiProxy* GetGuiProxy ();
	};
}
